﻿using System.Windows.Controls;
using Microsoft.Practices.Composite.Modularity;
using Microsoft.Practices.Composite.Regions;
using Microsoft.Practices.Unity;
using Microsoft.Practices.Composite.Events;
using Might.Infrastructure.Services;
using Might.Infrastructure.View;

namespace Might.ViewsTabControl {
    /// <summary>
    /// This module contains TabControl which contains Editor instances.
    /// </summary>
    public class ViewsTabControlModule : IModule {
        private IUnityContainer container;

        /// <summary>
        /// Initializes a new instance of the <see cref="ViewsTabControlModule"/> class.
        /// </summary>
        /// <param name="container">The container.</param>
        public ViewsTabControlModule(IUnityContainer container) {
            this.container = container;
        }

        /// <summary>
        /// Initializes this instance and register global services for other modules.
        /// Add this module to main application window.
        /// </summary>
        public void Initialize() {
            container.Resolve<IMightLogger>().Log(this, "Views TabControl module init");

            ViewsTabcontrolView view = container.Resolve<ViewsTabcontrolView>();
            // IRegion viewsTabControlRegion = regionManager.Regions["TabControlRegion"];
            //viewsTabControlRegion.Add(view);
            ((Border)MyRegionManager.Get("TabControlRegion")).Child = view;
        }
    }
}
